package com.qf.set;

import java.util.TreeSet;

public class TreeSetTest {
	
	public static void main(String[] args) {
		//TreeSet：有索引、无序、不重复
		randomNum();
		
	}
	public static void randomNum() {
		
		TreeSet<Integer> treeSet = new TreeSet<Integer>();
		
		
		while(treeSet.size()!=10) {
			java.util.Random random = new java.util.Random();
			
			int num = random.nextInt(10);
			System.out.println(num);
			treeSet.add(num);
			
			System.out.println(treeSet);
			
			
		}
		System.out.println(treeSet);
	}

}
